package com.linktel.productionLine.controller;


import com.linktel.productionLine.common.BaseResponse;
import com.linktel.productionLine.common.ResultUtils;
import com.linktel.productionLine.entity.HolidayStatistics;
import com.linktel.productionLine.service.HolidayStatisticsService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/holiday-statistics")
@AllArgsConstructor
@Slf4j
public class HolidayStatisticsController {

    protected HolidayStatisticsService baseStepService;

    @GetMapping
    public BaseResponse<List<HolidayStatistics>> listHolidayStatistics() {
        List<HolidayStatistics> holidayStatisticsList = baseStepService.listHolidayStatistics();
        return ResultUtils.success(holidayStatisticsList);
    }

    @PutMapping("/update")
    public BaseResponse<Boolean> updateHolidayStatistics(@RequestBody HolidayStatistics holidayStatistics) {
        Integer result = baseStepService.updateHolidayStatistics(holidayStatistics);
        log.info("HolidayStatisticsController 更改了{}条数据", result);
        return ResultUtils.success(true);
    }
}
